import React from "react";
import FeeReportService from "containers/data-center/fee-report/fee-report.service";
import 'styles/data-center/fee-report/fee-report.scss';
import {connect} from 'react-redux';

class FeeReport1 extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: true,
      tableUrl: ''
    }
  }

  componentDidMount() {
    this.getTableUrl();
  }

  //获取报表类型
  getTableUrl() {
    let params = {
      userId: this.props.user.id
    }
    FeeReportService.getReport1(params)
      .then((res) => {
        this.setState({
          tableUrl: res.data
        })
      })
  }

  render() {
    return (
      <div className="fee-report-setting-wrap">
        <iframe className='report-frame' src={this.state.tableUrl}/>
      </div>
    )
  }
}

FeeReport1.contextTypes = {
  router: React.PropTypes.object
};

function mapStateToProps(state) {
  return {
    user: state.login.user,
  }
}

export default connect(mapStateToProps)(FeeReport1);
